{extend name="public/base" /}

{block name="title"}<title>{if condition="$data"}{$Think.lang.edit}{else /}{$Think.lang.create}{/if}</title>{/block}

{block name="pjax_container"}
<div class="hry-content-wrapper">
    <section class="content-header">
        <ol class="breadcrumb">
            <li>企业端管理</li>
            <li class="active">项目方列表</li>
            <li class="active">项目方详情</li>
        </ol>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <form class="form-horizontal" method="POST" action="" onsubmit="return false">
                    <input type="hidden" name="id" value="{$project_info.id}"/>
                    <div class="nav-tabs-custom">
                        <ul class="nav nav-tabs">
                            <li class="active"><a href="#tab_base" data-toggle="tab">用款申请详情</a></li>
                            <li class="pull-right"><a href="javascript:history.back(-1)" class="btn btn-sm"
                                                      style="padding:10px 2px;"><i class="fa fa-list"></i>
                                {$Think.lang.back}</a></li>
                        </ul>
                        <div class="tab-content">
                            <div class="tab-pane active" id="tab_base">
                                <div class="project-title">用款申请</div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">项目名称</label>
                                    <div class="col-sm-7"><span class="text-form">{$project_info.project_name}</span></div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">项目方</label>
                                    <div class="col-sm-7"><span class="text-form">{$project_info.company_name}</span></div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">用款金额</label>
                                    <div class="col-sm-7"><span class="text-form">{$project_info.money}</span></div>
                                </div>
                            <div class="project-title">审核情况</div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">审核意见</label>
                                <div class="col-sm-1 text-form"><input  type="radio" value="1" name="systerm_check" checked><span> 通过</span></div>
                                <div class="col-sm-4 text-form"><input type="radio" value="2" name="systerm_check"><span> 拒绝</span></div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label" id="beizhulabel">备注信息</label>
                                <div class="col-sm-7"><textarea name="systerm_msg" id="beizhu" style="width: 100%" placeholder="拒绝时必须填写"></textarea></div>
                            </div>
                                <div class="box-footer">
                                    <div class="col-sm-2"></div>
                                    <div class="col-sm-7">
                                        <div class="btn-group pull-right">
                                            <button type="submit" class="btn btn-info pull-right" data-loading-text="&lt;i class='fa fa-spinner fa-spin '&gt;&lt;/i&gt; {$Think.lang.submit}">提交</button>
                                        </div>
                                    </div>
                                </div>
                        </div>
                    </div>
                    </div>
            </form>
        </div>
</div>
</section>
</div>
<script type="text/javascript" src="__STATIC__/hry/js/spark-md5.js"></script>
<script type="text/javascript">

    $(function () {
        $("form").submit(function () {
            var d = {};
            var t = $('form').serializeArray(); // 默认是json 格式
            //jQuery的循环
            $.each(t, function() {
                d[this.name] = this.value;
                console.info(d)
            });
            var json_str = JSON.stringify(t);
            submitForm(d)
        })
        $('input[type=radio][name=systerm_check]').change(function() {
            console.log(this.value)
            if(this.value === '1') {
                $('#beizhu').attr('required', false)
                $('#beizhulabel').removeClass('hry-require')
            } else{
                $('#beizhu').attr('required', true)
                $('#beizhulabel').addClass('hry-require')
            }
        });
        {if condition = " $rest_login == 1 "}
        restlogin('{$rest_login_info}');   //登录超时
        {/if}
        }
    )
    function submitForm(filed) {
        $.ajax({
            url: '/hryweb.php/project_side/detailDivideCheck',
            data: filed,
            type: "POST",
            dataType: "json",
            success: function (result) {
                if (result.status == 1) {
                    $.amaran({'message': result.info});
                    window.location.href = result.url;
                } else {
                    $.amaran({'message': result.info});
                }
            },
            error: function (result, xhr, status, errorThrown) {
                $.amaran({'message': result.info})
            },
            complete: function (xhr, status) {
//                    alert('The request is complated');
            },
            beforesend: function () {
            },
            cache: false,//true
            async: true
        })
    }
</script>
<style>
    .text-form {
        line-height: 26px;
        padding-top: 7px;
        display: inline-block;
    }

    .project-title {
        font-size: 18px;
        margin: 20px 0 20px 18px;
    }

    .project-title:before {
        content: '|';
        font-weight: bolder;
        color: #00c0dc;
        margin-right: 14px;
    }
</style>
{/block}